import 'package:flutter/material.dart';
import 'package:dna/dna.dart';
void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    final f = Theme.of(context).brightness == Brightness.dark ? "dark" : "light";

    return Scaffold(
      body: Container(
        child: FlatButton(
          child: Text("click"),
          onPressed: (){
            ObjCContext cContext = ObjCContext();
            NativeObject uiDevice = cContext.classFromString("UIDevice");
            NativeObject device = uiDevice.invoke(method: 'currentDevice');
            NativeObject version = device.invoke(method: 'systemVersion');
            cContext.returnVar = version;
            var versionString = cContext.execute();
            print("version = $versionString");
          },
        ),
      ),
    );
  }
}